var app = getApp()
Page({
  data: {
    url: {
      getFlow: app.url.baseUrl + "/my/scoreFlow"
    },
    pageNumber: -1,
    appList: [],
    isPage: true,
    score: 0
  },
  onLoad: function (o) {
    this.setData({ score: o.score})
    this.getFlow()
  },
  getFlow:function(){
    if (!this.data.isPage) {
     //提示
      return;
    }
    var that = this;
    var appList = this.data.appList
    var data = { pageNumber: this.data.pageNumber + 1 }
    app.ajax(this.data.url.getFlow, data, function (res) {
      var data = res.data.data
      var b = true
      if (data.length <= 20)
        b = false

      for(var i = 0;i<data.length;i++){
        var obj = data[i]
        appList.push(obj)
      }
      that.setData({ appList: appList, isPage: b, pageNumber: that.data.pageNumber += 1 })
    });
  },
  onReachBottom:function(){
    this.getFlow();
  },
  refreshData: function () {
    //初始化数据
    this.setData({ pageNumber: -1, appList: [], isPage: true });
    this.getFlow()
  }
})

